package com.tarena.lbs.common.utils;

import com.tarena.lbs.base.protocol.pager.BasePageQuery;
import com.tarena.lbs.base.protocol.pager.PageResult;

import java.util.List;

public class PageResultBuilder {
    public static <T> PageResult<T> build(List<T> data){
        PageResult<T> result = new PageResult<>(new BasePageQuery());
        result.setObjects(data);
        result.setTotal((long)data.size());
        return result;
    }
    public static <T> PageResult<T> build(List<T> data, BasePageQuery query){
        PageResult<T> result = new PageResult<>(query);
        result.setObjects(data);
        result.setTotal((long)data.size());
        return result;
    }
}
